The numbers and diversity of pterosaurs alive as dinosaurs became extinct was much higher than previously thought it has been revealed following the discovery of six new species.
Researchers from the universities of Bath and Portsmouth found the fossils of the different types of the giant flying reptiles in Morocco, causing them to re-evaluate the history of the cousin of the dinosaurs.
The prehistoric reptiles were previously thought to be in decline before the extinction of the dinosaurs 66 million years ago caused by an asteroid impact.
But the new study, published in the journal PLOS Biology, explains how the fossils from the end of the Cretaceous period found in Morocco show that the region supported seven species in three different families.
This means that there was "huge diversity" at the point of their extinction.
Professor David Martill, from the University of Portsmouth, said: "Exciting discoveries are being made all the time, and sometimes, just the smallest of bones can radically change our perception of the history of life on Earth."
It had been thought that the rarity of pterosaur fossils from the end of the dinosaur era meant that they were slowly going extinct but the new discoveries suggest that the lack of fossils has skewed the data and that the pterosaurs were far more diverse than thought at this time.
Dr Nick Longrich, from the University of Bath, said: "To be able to grow so large and still be able to fly, pterosaurs evolved incredibly lightweight skeletons, with the bones reduced to thin-walled, hollow tubes like the frame a carbon-fibre racing bike.
"But, unfortunately, that means these bones are fragile, and so almost none survive as fossils."
The fossils were found in marine rocks from phosphate mines in northern Morocco, which were formed when greenhouse conditions drove sea levels up, flooding North Africa.
The pterosaurs discovered ranged in wingspan from just over two metres to up to 10 metres, almost three times bigger than the largest living bird, and weighed up to 200kg.
The fossils date to just over 66 million years ago, to the very end of the Cretaceous period, making these pterosaurs among the last of their kind on Earth.
A Portsmouth university spokesman said: "Dr Longrich found a single small bone mixed in with a collection of fossil fish dug up from a phosphate mine in northern Morocco.
"He identified that it belonged to nyctosaurs, a group of small pterosaurs, that hadn't been proven to survive to the end of the Cretaceous.
"On a hunch, he looked for more pterosaurs, and found more species -
including Tethydraco, a member of the pteranodontids, a family that had been thought to have disappeared 15 million years earlier. In addition to the single species previously found in the area, six additional species turned up."
Dr Brian Andres, research associate at the University of Texas at Austin, also a co-author of the study, added: "The Moroccan fossils tell the last chapter of the pterosaurs' story - and they tell us pterosaurs dominated the skies over the land and sea, as they had for the previous 150 million years."